import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:niuren_demo/configs/App_style_config.dart';
import 'package:niuren_demo/model/MessagePage_model.dart';
import 'package:niuren_demo/view/text/text_style.dart';

class MessageItem extends StatelessWidget {
  final MessagePageModel dataModel;

  const MessageItem({Key key, this.dataModel}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
      decoration: BoxDecoration(
        color: Colors.white,
        border: Border(
            bottom:
                BorderSide(width: 1, color: AppStyleConfig.backgroundColor)),
      ),
      child: Column(
        children: [
          Row(
            children: [
              Expanded(
                child: Row(
                  children: [
                    Icon(
                      Icons.add_circle,
                      size: 30,
                      color: dataModel.look
                          ? AppStyleConfig.themColor
                          : Colors.grey,
                    ),
                    Text_style(
                      data: dataModel.title == 1
                          ? "【系统消息】"
                          : dataModel.title == 2
                              ? "【广告消息】"
                              : "【注册消息】",
                      color: dataModel.look ? Colors.black : Colors.grey,
                    ),
                    Text_style(
                      data: dataModel.look ? "未读" : "已读",
                      color: dataModel.look ? Colors.blue : Colors.grey,
                    ),
                  ],
                ),
              ),
              Text_style(
                data: dataModel.date,
                color: Colors.grey,
              ),
              Text_style(
                data: dataModel.time,
                color: Colors.grey,
              ),
            ],
          ),
          SizedBox(height: 10,),
          Row(
            children: [
              Visibility(
                visible: dataModel.look,
                child: Container(
                  width: 10,
                  height: 10,
                  decoration: BoxDecoration(
                    color: Colors.red,
                    borderRadius: BorderRadius.circular(10),
                  ),
                ),
              ),
              SizedBox(width: 4,),
              Expanded(
                child: Container(
                  child: Text_style(
                    data: dataModel.content,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    color: dataModel.look ? Colors.black : Colors.grey,
                  ),
                ),
              ),
            ],
          )
        ],
      ),
    );
  }
}
